<?php
/**
 * 会员管理控制器类
 */
namespace Admin\Controller;
use Think\Controller;

class MemberController extends CommonController
{
    // 会员管理
    public function member_list()
    {
        $member_list = M('users')->field('uid,uname,sex,email,act_email,city,login_time,available')->select();
        $this->assign('member_list', $member_list);
        $this->display();
    }

    // 停用会员账号
    public function member_stop()
    {
        $post_data = I('post.data');
        $stop = M('users')->where('uid='.$post_data)->setField('available', '0');
        if ($stop) {
            $info['id'] = $post_data;
            $info['type'] = 1;
            $info['info'] = '停用成功';
            $this->ajaxReturn($info);
        } else {
            $info['type'] = 0;
            $info['info'] = '停用失败';
            $this->ajaxReturn($info);
        }
    }

    // 启用管理员账号
    public function member_start()
    {
        $post_data = I('post.data');
        $stop = M('users')->where('uid='.$post_data)->setField('available', '1');
        if ($stop) {
            $info['id'] = $post_data;
            $info['type'] = 1;
            $info['info'] = '启用成功';
            $this->ajaxReturn($info);
        } else {
            $info['type'] = 0;
            $info['info'] = '启用失败';
            $this->ajaxReturn($info);
        }
    }

    public function member_del()
    {
        $del_list = M('users')->field('uid,uname,sex,email,act_email,city,login_time,available')->where('available=0')->select();
        $this->assign('del_list', $del_list);
        $this->display();
    }

    public function member_level()
    {
        $this->display();
    }

    public function member_kiss()
    {
        $this->display();
    }

    public function member_view()
    {
        $this->display();
    }
    // 会员账户详细资料
    public function member_show()
    {
        $get_data = I('get.uid');
        $list = M('users u1')->join('inner join users_ext ue on u1.uid=ue.id')->where('u1.uid='.$get_data)->field('u1.uname,u1.create_for_qq,u1.create_for_wb,u1.create_time,ue.kiss,ue.avatar,ue.sign,ue.vip')->find();
        $this->assign('list', $list);
        $this->display();
    }
}